<include file="__PUBLIC__/head.html"/>
<css file="__PUBLIC__/css/arc.css"/>
<js file="__PUBLIC__/js/arc.js"/>
<css file="__ROOT__/uploadify/uploadify.css"/>
<script type="text/javascript" src="__ROOT__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/jqueryui.js"></script>
<script>
    $(function() {
        $("#pic_thumb").uploadify({
            height        : 30,
            buttonImage   : '__ROOT__/uploadify/button.jpg',
            swf           : '__ROOT__/uploadify/uploadify.swf',
            uploader      : '__CONTROL__/upload/{$sonid}/{$cokval}',
            width         : 120,
            onUploadSuccess:function(file, data, response) {
                eval("data="+data);
                if(data.msg=='error'){
                    alert("上传失败");return;
                }
                var str='';
                str='<div>\
                <input type="hidden" name="rec_img" value="'+data.file+'"/><input type="hidden" name="pic_thumb" value="'+data.thumb+'"/>\
                <img rec_img="'+data.file+'" thumb="'+data.thumb+'" src="__ROOT__/'+data.thumb+'" width="120" heigth="80"/><span class="delpic">删除</span></div>'
                $.post("__CONTROL__/delpic",{path:$(".pic img").attr("thumb"),rec:$(".pic img").attr("rec_img")})
                $(".pic").html("").append(str);
            }
        });
        //AJAX删除
        $(function(){
            $(".delpic").live("click",function(){
                var liObj= $(this).parent();
                var file_path =$(this).prev("img").attr("thumb");
                var rec_img=$(this).prev("img").attr("rec_img")
                $.post("__CONTROL__/delpic",{path:file_path,rec:rec_img},function(data){
                    if(data==1){
                        liObj.remove();
                        alert('删除成功');
                    }else{
                        alert("删除失败");
                    }

                })
            })
        })
        $(".click").val(Math.floor(Math.random()*200)+100)
        $( "#tab" ).tabs();
    });
</script>
</head>
<body>
    <form action="__CONTROL__/add" method="post" enctype="multipart/form-data">
        <div id="tab" class="content add_show">
            <ul>
                <li><a href="#tabs-1">基本设置</a></li>
                <li><a href="#tabs-2">SEO设置</a></li>
            </ul>
            <div id="tabs-1">
                <table class="table1">
                    <tr>
                        <th>选择栏目</th>
                        <td>
                            <select name="cat_id">
                                <option value="0">===选择栏目===</option>
                                <list from="$category" name="$c">
                                <option value="{$c.cat_id}">{$c.html}{$c.cat_name}</option>
                                </list>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>标题</th>
                        <td>
                            <input class="entry" type="text" name="title"/>
                        </td>
                    </tr>
                    <tr>
                        <th>属性</th>
                        <td>
                            <label><input type="checkbox" name="is_ding" value="1"/> 置顶</label>&nbsp;&nbsp;&nbsp;&nbsp;
                            <label><input type="checkbox" name="is_tui" value="1"/> 推荐</label>
                        </td>
                    </tr>
                    <tr>
                        <th>缩略图</th>
                        <td>
                            <input type="file" id="pic_thumb" name="pic_thumb"/>
                            <div class="pic">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>点击次数</th>
                        <td>
                            <input class="click" type="text" name="click" value="100"/>
                        </td>
                    </tr>
                    <tr>
                        <th>正文内容</th>
                        <td>
                    <editor type="1" max="3000" name="content"/>
                    </td>
                    </tr>
                </table>
            </div>

            <div id="tabs-2">
                <table class="table1">
                    <tr>
                        <th>关键字</th>
                        <td>
                            <input class="entry" type="text" name="keywords"/><span style="color: #d00;">多个关键词用 | 或 ，建议填三到五个</span>
                        </td>
                    </tr>
                    <tr>
                        <th>描述</th>
                        <td>
                            <textarea class="entry" cols="50" row="15" name="description"></textarea><span style="color: #d00;">建议控制在80个字符以内</span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="sub">
                <input type="submit" value="添加内容" title="点确认发布"/>
            </div>
        </div>
    </form>
</body>
</html>